package jam;

import jam.model.ServerModel;
import jam.network.NetworkController;
import jam.sql.SQLController;

//
// =============================================================================
//

/**
 * An active server application.
 */
public class ServerApplication implements Runnable {
    private ServerModel model;
    private NetworkController networkController;
    private SQLController sqlController;
    
    //
    // =========================================================================
    //

    /**
     * Constructor. Performs initialisation so run() can be called.
     */
    public ServerApplication() {
        this.model = new ServerModel();
        this.networkController = new NetworkController(model);
        this.sqlController = SQLController.getInstance();
    }

    /**
     * Starts the server, opening the socket and so on.
     */
    public void run() {
        this.networkController.listen();
    }
}
